package com.pig4cloud.pigx.common.customize.exception;

import com.pig4cloud.pigx.common.customize.enums.AbnormalEnum;

/**
 * 通用全局异常
 */
public class DuckweedException extends RuntimeException {

    private final int code;

    public DuckweedException() {
        this(1, "操作失败");
    }

    public DuckweedException(AbnormalEnum.MSG msg) {
        super(msg.getMessage());
        this.code = msg.getCode();
    }

    public DuckweedException(int code, String message) {
        super(message);
        this.code = code;
    }

    public DuckweedException(String message) {
        this(1, message);
    }

    public int getCode() {
        return code;
    }

}
